WIP - Try running vitest instead of jest for co2.js #235
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Triage
Type of change
Please select any of the below items that are appropriate.
This pull request:
Related issue/s
Please list below any issues this pull request is related to.
Docs changes required
Do any changes made in this pull request require parts of the CO2.js documentation to be updated?
If you answered "Yes", please create an corresponding issue in our Developer Documentation repository.
Describe the changes made in this pull request
This is a test PR as an experiment in trying out Vitest, a more actively maintained testing library than Jest. It also seems to be faster to run, and was not too complicated to try migrating the exiting codebase to use it instead of jest.
Update: actually, I don't think it's that much faster to run, but the output is clearer in terms of showing where the slow tests are:
With jest
With vitest
Note: I think eslint relies on jest, so jest is still bundled into the dev dependencies for package.json.
As clearly as possible, describe the changes made in the pull request. You should at least detail "what changes have been made" and "what the results of these changes will be".
The main changes are
Testing Framework Migration:
package.json
and updated test scripts__mocks__/https.js
)Workflow Configuration:
.github/workflows/unittests.yml
to [18.x, 20.x, 22.x] and updated actions versionsDependency Updates:
@tgwf/url2green
to version^0.4.1
inpackage.json
(this was needed to run npm install successfully. It can be added separately)vitest
as a new dependency inpackage.json
Note: There's no need to merge this in. We probably want to break this PR up into separate changes as there are three separate kinds of changes here (bumping url2green, updating unit tests, and then adding migrating to vitest). It was just a quick experiment after I tried vitest on url2green, and wondered how much work it might be to use in co2.js.